<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../org/angular.min.js"></script>
    <style>
        .lock {
            background: #dcdcdc;
        }

        .red {
            color: red;
        }
    </style>
</head>

<body ng-app="app" ng-controller="ctrl">
    <h1>
        ng-class动态样式实例
    </h1>
    <table width="500" border="1">
        <tr>
            <th>姓名</th>
            <th>年龄</th>
            <th>状态</th>
        </tr>
        <tr ng-repeat="(k,v) in data" ng-class="{lock:v.status==0}">
            <td ng-class="{red:v.age>=30}">{{v.name}}</td>
            <td>{{v.age}}</td>
            <td>{{v.status}}</td>
        </tr>
    </table>
    <script>
        var m = angular.module('app', []);
        m.controller('ctrl', ['$scope', function($scope) {
            $scope.data = [{
                    name: '张三',
                    age: 30,
                    status: 0
                },
                {
                    name: '李四',
                    age: 10,
                    status: 1
                },
                {
                    name: '王五',
                    age: 19,
                    status: 1
                },
                {
                    name: '倩倩',
                    age: 40,
                    status: 0
                },
                {
                    name: '兰兰',
                    age: 50,
                    status: 0
                }
            ];
        }])
    </script>
</body>

</html>
